package com.Exception异常.自定义异常;

import java.util.EmptyStackException;
import java.util.Scanner;

/**
 * 作    者 ：吾路巴尼
 * 创建时间 ：2025/2/19-22:24
 */
public class throwExercise01 {
    public static void main(String[] args) {
        try {
            if(args.length != 2)
                throw new ArrayIndexOutOfBoundsException("参数个数不对");
            int n1 = Integer.parseInt(args[0]);
            int n2 = Integer.parseInt(args[1]);

            int result = cel(n1,n2);
            System.out.println("结果为 "+result);

        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println(e.getMessage());
        }catch (NumberFormatException e){
            System.out.println(e.getMessage());
        }catch (ArithmeticException e){
            System.out.println(e.getMessage());
        }

    }
    public static int cel(int n1,int n2){
        return n1/n2;
    }
}
